package com.ruoyi.merchant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 公告状态枚举
 */
@Getter
@AllArgsConstructor
public enum AnnouncementStatusEnum {
    
    DRAFT(0, "草稿"),
    PUBLISHED(1, "已发布"),
    OFFLINE(2, "已下线");
    
    private final Integer code;
    private final String desc;
    
    public static String getDescByCode(Integer code) {
        if (code == null) {
            return "";
        }
        for (AnnouncementStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status.getDesc();
            }
        }
        return "";
    }
}
